Don't create a big string, since Visual C++ doesn't like strings longer
authorMatthias Clasen <mclasen@redhat.com>
Wed, 23 Nov 2005 15:09:47 +0000 (15:09 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Wed, 23 Nov 2005 15:09:47 +0000 (15:09 +0000)
2005-11-23  Matthias Clasen  <mclasen@redhat.com>

* gtk/updateiconcache.c (write_csource): Don't create a big
string, since Visual C++ doesn't like strings longer than 64k.
(#322238, Kazuki IWAMOTO

ChangeLog
ChangeLog.pre-2-10
gtk/updateiconcache.c

index d9f041904a37186182d477d4dff0fe46160eb563..f4b4007c354a3c66c5cc9325a60e27d40855066b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2005-11-23  Matthias Clasen  <mclasen@redhat.com>
 
+       * gtk/updateiconcache.c (write_csource): Don't create a big
+       string, since Visual C++ doesn't like strings longer than 64k. 
+       (#322238, Kazuki IWAMOTO
+
        * gtk/gtkentry.c: Include gtkimcontextsimple.h  (#322235,
        Kazuki IWAMOTO)
 
index d9f041904a37186182d477d4dff0fe46160eb563..f4b4007c354a3c66c5cc9325a60e27d40855066b 100644 (file)
@@ -1,5 +1,9 @@
 2005-11-23  Matthias Clasen  <mclasen@redhat.com>
 
+       * gtk/updateiconcache.c (write_csource): Don't create a big
+       string, since Visual C++ doesn't like strings longer than 64k. 
+       (#322238, Kazuki IWAMOTO
+
        * gtk/gtkentry.c: Include gtkimcontextsimple.h  (#322235,
        Kazuki IWAMOTO)
 
index 9453e73974b16cdad2df0d8b2800f52a4f1ff55f..86add541ca1a45377d1f3168c62e94c6334e586f 100644 (file)
@@ -1247,9 +1247,7 @@ write_csource (const gchar *path)
 {
   gchar *cache_path;
   gchar *data;
-  guint8 d;
   gsize len;
-  gint pos;
   gint i;
 
   cache_path = g_build_filename (path, CACHE_NAME, NULL);
@@ -1265,40 +1263,18 @@ write_csource (const gchar *path)
   g_printf ("#else\n");
   g_printf ("static const guint8 %s[] = \n", var_name);
   g_printf ("#endif\n");
-  g_printf ("{ ""\n  \"");
-  
-  pos = 3;
-  for (i = 0; i < len; i++)
+
+  g_printf ("{\n");
+  for (i = 0; i < len - 1; i++)
     {
-      d = data[i];
-      if (pos > 70)
-       {
-         g_printf ("\"\n  \"");
-         pos = 3;
-       }
-      if (d < 33 || d > 126 || d == '?')
-       {
-         g_printf ("\\%.3o", d);
-         pos += 4;
-         continue;
-       }
-      if (d == '\\')
-       {
-         g_printf ("\\\\");
-         pos += 2;
-       }
-      else if (d == '"')
-       {
-         g_printf ("\\\"");
-         pos += 2;
-       }
-      else 
-       {
-         g_printf ("%c", d);
-         pos += 1;
-       }
+      if (i %12 == 0)
+       g_printf ("  ");
+      g_printf ("0x%02x, ", (guint8)data[i]);
+      if (i % 12 == 11)
+        g_printf ("\n");
     }
-  g_printf ("\"};\n");
+  
+  g_printf ("0x%02x\n};\n", (guint8)data[i]);
 }
 
 static GOptionEntry args[] = {